Skip to content

Migrate lint/format tooling to Ruff, update CI matrix, and stabilize cross-platform/firefox tests#1978

Draft
yuriverweij wants to merge 13 commits intorobotframework:masterfrom
yuriverweij:fix/update-linting-checking-and-formatting
Draft

Migrate lint/format tooling to Ruff, update CI matrix, and stabilize cross-platform/firefox tests#1978
yuriverweij wants to merge 13 commits intorobotframework:masterfrom
yuriverweij:fix/update-linting-checking-and-formatting

Conversation

@yuriverweij
Copy link
Copy Markdown
Member

@yuriverweij yuriverweij commented Apr 25, 2026

This branch replaces legacy lint/format tooling with Ruff, updates CI and runtime compatibility targets, and cleans up platform/browser-specific test behavior so checks are consistent across environments.

Major changes

  • Replaced Flake8 and Black with Ruff for linting and formatting.
  • Added/updated Invoke tasks for linting and formatting in tasks.py
  • Added/updated dedicated GitHub workflow for Ruff lint/format checks in LintFormatCheck.yml
  • Configured lint/format workflow to run both format and lint steps, then fail the job if either step fails.
  • Re-enabled Firefox testing in CI and marked one unstable mouse-over acceptance case as a known issue for Firefox in mouse.robot
  • Re-enabled previously skipped Windows unit tests by normalizing line ending behavior via .gitattributes.
  • Updated minimum supported Python version to 3.10 and aligned GitHub workflows accordingly.
  • Refactored type hints to Python 3.10+ syntax (for example, union operator style).
  • Replaced collections.namedtuple usages with typing.NamedTuple in affected unit-test helpers/constructors.
  • Applied import-order and formatting cleanups required by Ruff rules.

Documentation updates

  • Updated contributor guidance for new lint/format commands in CONTRIBUTING.rst

Behavioral impact

  • No intended product/runtime behavior changes in SeleniumLibrary keywords.
  • Main impact is development workflow, CI behavior, typing/style modernization, and test-platform handling.

CI and quality checks

  • Ruff format check now runs in check mode with diff output.
  • Ruff lint check runs in the same workflow.
  • Workflow reports both step outcomes and fails if one or both fail.
  • Firefox is re-enabled with known-issue handling for the unstable case.

Notes

  • atest/ linting is not enabled yet.
  • The Firefox known issue should be tracked for eventual removal once root cause is resolved.
  • Worth looking into other existing known-issues

yuriverweij and others added 13 commits April 13, 2026 18:58
- Updated type hints to use the new syntax (e.g., `list[str]` instead of `List[str]`).
- Improved readability by replacing `isinstance` checks with more concise conditions.
- Simplified exception handling and error messages for better clarity.
- Enhanced the `WindowInfo` class by switching from `namedtuple` to `NamedTuple`.
- Streamlined the `get_window_infos` method to reduce redundancy.
- Replaced assertions in unit tests with assert statements for consistency.
- Updated the linting task to allow automatic fixing of issues.
- Removed unnecessary imports and cleaned up code formatting.
- Updated test_event_firing_webdriver.py to use pytest for exception assertions.
- Refactored test_plugin_keyword_tags.py to utilize MyLib and MyLibArgs classes.
- Changed test_plugins.py to use NamedTuple for plugin representation and improved exception handling with pytest.
- Modified test_entry_point.py to include pathlib import.
- Reordered imports and improved exception assertions in various test files.
- Enhanced test_webdrivercreator.py and test_webdrivercreator_executable_path.py for better readability and consistency.
- Updated test_browsermanagement.py to use pytest for exception assertions and improved assertions.
- Refactored test_click_modifier.py to streamline invalid modifier tests.
- Improved test_cookie.py and test_expectedconditions.py for consistency and clarity.
- Enhanced test_firefox_profile_parsing.py and test_input_text_file_decorator.py for better readability.
- Refactored test_keyword_arguments_browsermanagement.py and test_keyword_arguments_element.py for consistency.
- Updated test_windowmanager.py and test_elementfinder.py to improve exception handling and assertions.
- Added translation tests and improved type handling in test_types.py.

Co-authored-by: Copilot <[email protected]>
…revent password manager leak detection in Chrome
@yuriverweij yuriverweij changed the title Fix/update linting checking and formatting Migrate lint/format tooling to Ruff, update CI matrix, and stabilize cross-platform/firefox tests Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant